package com.xs.bookspoststation.BookActivity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.xs.bookspoststation.AdminActivity.AdminActivity;
import com.xs.bookspoststation.R;
import com.xs.bookspoststation.UserActivity.MainActivity;

public class OperateBookActivity extends AppCompatActivity {
    //定义对象
    private Button AddBookInfoBtn,BookViewBtn,returnBeforeBtn,returnLoginBtn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_operate_book);
        //绑定控件
        AddBookInfoBtn = findViewById(R.id.btn_add_book1);
        BookViewBtn = findViewById(R.id.btn_sel_book1);
        returnBeforeBtn = findViewById(R.id.btn_book_goback1);
        returnLoginBtn = findViewById(R.id.btn_book_back2);

        //添加图书信息
        AddBookInfoBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(OperateBookActivity.this,AddBookActivity.class);
                startActivity(intent);
                Toast.makeText(OperateBookActivity.this, "前往添加图书信息", Toast.LENGTH_LONG).show();
            }
        });
        //查看图书信息
        BookViewBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(OperateBookActivity.this,BookViewActivity.class);
                startActivity(intent);
                Toast.makeText(OperateBookActivity.this, "前往查看图书信息", Toast.LENGTH_LONG).show();
            }
        });
        //返回上一级
        returnBeforeBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(OperateBookActivity.this, AdminActivity.class);
                startActivity(intent);
                Toast.makeText(OperateBookActivity.this,"正在前往管理员主界面", Toast.LENGTH_LONG).show();
            }
        });
        //返回到登录界面
        returnLoginBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                Intent intent=new Intent(OperateBookActivity.this, MainActivity.class);
                startActivity(intent);
                Toast.makeText(OperateBookActivity.this,"正在前往登录界面", Toast.LENGTH_LONG).show();
            }
        });
    }
}
